var volume = new Array();
var timerVolume = new Array();

function volumeInit(slot) {
	volume[slot] = $("#vid-"+slot+"-volume").slider({
		handle: ".vid-slider-vol-handle",
		change: function(e,ui) { 
			volumeTimer(slot);
		},
		start: function(e,ui) {
			timerVolume[slot] = setInterval("volumeTimer("+slot+")", sliderInterval);
		},
		stop: function(e,ui) {
			clearInterval(timerVolume[slot]);
		}
	});
	vidVolume[slot] = 100;
	setVolumeSlider(vidVolume[slot], slot);
}

function volumeTimer(slot) {
	vidVolume[slot] = 100 - volume[slot].slider("value");
	videoVolume(slot);
}

function setVolumeSlider(perc, slot) {
	//printLog('Set volume slider '+slot+' to value: '+perc);
	if (perc == 0) perc = -100;
	if (perc == 100) perc = 200;
	volume[slot].slider("moveTo", 100-perc);
}